<template>
	<div id='tmpl'>
		<div class="inleft div" @click='substrict'>-</div>
		<div class="incenter div" v-text='count'>1</div>
		<div class="inright div" @click='add'>+</div>
	</div>
</template>
<script>
	export default{
		data(){
			return{
				count:1
			}
		},
		methods:{
			substrict(){
				this.count--;
				if(this.count<=1){
					this.count=1;
				}
				this.sendmessage();
			},
			add(){
				this.count++;
				this.sendmessage();
			},
			sendmessage(){
				this.$emit('dataobj',this.count)
			}
		}
	}
</script>
<style scoped>
	#tmpl .div{
		width: 40px;
		height: 25px;
		line-height: 25px;
		border: 1px solid #000;
		display: inline-block;
		text-align: center;
	}
	#tmpl .div:hover{
		background: #eee;
	}
</style>